{extend name="public/base"}

{block name="x-body"}
<div class="x-body">
    <form class="layui-form">
        {if $id}
         <input type="hidden" name="id" value="{$res.id}">
        {/if}

        <div class="layui-form-item">
            <label for="position_name" class="layui-form-label">
                <span class="x-red">*</span>广告位名称
            </label>
            <div class="layui-input-inline">
                <input type="text" id="position_name" name="position_name" value="{$res.position_name}" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="ad_width" class="layui-form-label">
                <span class="x-red">*</span>广告位宽度
            </label>
            <div class="layui-input-inline">
                <input type="text" id="ad_width" name="ad_width" value="{$res.ad_width}" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                px
            </div>
        </div>

        <div class="layui-form-item">
            <label for="ad_height" class="layui-form-label">
                <span class="x-red">*</span>广告位高度
            </label>
            <div class="layui-input-inline">
                <input type="text" id="ad_height" name="ad_height" value="{$res.ad_height}" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                px
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label for="position_desc" class="layui-form-label">
                广告位描述
            </label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" id="position_desc" name="position_desc" class="layui-textarea">{$res.position_desc}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                {$id ? '修改' : '增加'}
            </button>
        </div>
    </form>
</div>
<script>
    formData('{:url("ad/adPosition_form")}', 'add', function (){
        parent.location.reload();
        // 获得frame索引
        var index = parent.layer.getFrameIndex(window.name);
        //关闭当前frame
        parent.layer.close(index);
    }, false);
</script>
{/block}